name: Checks

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master

jobs:
  yaspeller:
    name: Spell check
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Spell check
        # problem matching breaks loop when it finds unrelated data, so we use reverse grep to clear output
        run: |
          echo "::add-matcher::.github/problem-matchers/yaspeller.json"
          set -o pipefail; npx yaspeller -c .yaspellerrc.json . 2>&1 >/dev/null | grep -v "\-\-\-\-\-" | grep -v "Typos"
          echo "::remove-matcher owner=yaspeller::"

  editor-config:
    name: Editor Config check
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Editor Config Check
        # problem matching breaks loop when it finds unrelated data, so we use reverse grep to clear output
        run: |
          echo "::add-matcher::.github/problem-matchers/editor-config.json"
          set -o pipefail; npx eclint check "**/*.md" 2>&1 >/dev/null | grep -v "EditorConfig"
          echo "::remove-matcher owner=editor-config::"

  directory-tree:
    name: Directory tree check
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Directory tree check
        run: |
          echo "::add-matcher::.github/problem-matchers/check-directory-tree.json"
          bash ./tools/check_directory_tree.sh tlroadmap
          echo "::remove-matcher owner=check-directory-tree::"
